package ua.com.infinite.mobile.db;

import ua.com.infinite.mobile.contentprovider.InfiniteContentProvider;
import android.content.ContentResolver;
import android.database.SQLException;
import android.database.sqlite.SQLiteDatabase;
import android.net.Uri;

public class TableTransaktions {

	public static final String TABLE_NAME = "transaktions";
	public static final String COLUMN_USER_ID = "user_id";
	public static final String COLUMN_ID = "_id";
	public static final String COLUMN_PARTNER_ID = "partn_id";
	public static final String COLUMN_PARTNER_NAME = "partn_name";
	public static final String COLUMN_BRANCH_ID = "branch_id";
	public static final String COLUMN_POS_IMEI = "pos_imei";
	public static final String COLUMN_CARD_NUMBER = "card_number";
	public static final String COLUMN_DATE = "date";
	public static final String COLUMN_ACTION_TIPE = "act_type";
	public static final String COLUMN_CANCEL_ID = "cancel_id";
	public static final String COLUMN_PAYMENT = "payment";
	public static final String COLUMN_CARD_TYPE = "card_type";
	public static final String COLUMN_CARD_PERCENT = "card_percent";
	public static final String COLUMN_BONUS = "bonus";
	public static final String COLUMN_BALLANCE_BONUS = "ballance_bonus";
	public static final String COLUMN_FEE_PERCENT = "fee_perc";
	public static final String COLUMN_FEE = "fee";
	public static final String COLUMN_FEE_BALANCE = "fee_ballance";
	public static final String COLUMN_COMMENT = "comment";
	public static final String COLUMN_STATUS = "status";

	public static final Uri CONTENT_URI = Uri.parse("content://" + InfiniteContentProvider.AUTHORITY + "/" + TABLE_NAME);

	public static final String CONTENT_TYPE = ContentResolver.CURSOR_DIR_BASE_TYPE + "/transaktions";
	public static final String CONTENT_ITEM_TYPE = ContentResolver.CURSOR_ITEM_BASE_TYPE + "/transaktion";

	public static final String CREATE_TABLE = "create table " + TABLE_NAME + "(" + COLUMN_ID + " integer primary key, " 
			+ COLUMN_USER_ID+ " integer, " 
			+ COLUMN_PARTNER_ID + " integer, " 
			+ COLUMN_BRANCH_ID + " integer, " 
			+ COLUMN_PARTNER_NAME + " text, " 
			+ COLUMN_POS_IMEI + " text, "
			+ COLUMN_CARD_NUMBER + " text, " 
			+ COLUMN_ACTION_TIPE + " integer, "
			+ COLUMN_CANCEL_ID + " integer, " 
			+ COLUMN_PAYMENT + " integer, " 
			+ COLUMN_CARD_TYPE + " integer, "
			+ COLUMN_CARD_PERCENT + " integer, " 
			+ COLUMN_BONUS + " integer, "
			+ COLUMN_BALLANCE_BONUS + " integer, " 
			+ COLUMN_FEE_PERCENT + " integer, "
			+ COLUMN_FEE + " integer, "
			+ COLUMN_FEE_BALANCE + " integer, " 
			+ COLUMN_COMMENT + " integer, " 
			+ COLUMN_STATUS + " integer, "
			+ COLUMN_DATE + " text" + ");";

	public static void onCreate(SQLiteDatabase db) {
		try {
			db.execSQL(CREATE_TABLE);
		} catch (SQLException e) {
			e.printStackTrace();
		}
	}

}
